import { ApiProperty } from "@nestjs/swagger";
import { IsOptional, IsString, ValidateNested } from "class-validator";
import { BaseQueryDto } from "../base.dto";
import { Type } from "class-transformer";

class PermissionWhereDto {
    @ApiProperty({ description: "权限代码" })
    @IsString()
    @IsOptional()
    code?: string;
}

export class PermissionQueryDto extends BaseQueryDto {
    @ApiProperty({ type: PermissionWhereDto, description: "查找规则" })
    @ValidateNested()
    @Type(() => PermissionWhereDto)
    @IsOptional()
    where?: PermissionWhereDto;
}
